<template>
	<div>
		<input type="file" @change="onChange" multiple name="" id="" />
		<el-button @click="onClick">下载</el-button>
	</div>
</template>
<script>
export default {
	data() {
		return {}
	},
	methods: {
		onChange(e) {
			const files = e.target.files
			const file = files[0]
			const formData = new FormData()
			formData.append('file', file)
			this.$http.post('/api/upload', formData).then((res) => {
				console.log(res, 'res')
			})
		},
		onClick() {
			this.$http.get('/api/downLoadFile').then((res) => {
				console.log(res.data.data, 'res')
				let uint8Array = new Uint8Array(res.data.data)
				console.log(uint8Array, 'uint8Array')
				// for (var i = 0; i < bufferArray.length; ++i) {
				// 	uint8Array[i] = bufferArray[i]
				// }
			})
		}
	}
}
</script>
